﻿namespace RuoVea.Swms.Server.Models;

/// <summary>
/// 库存变动历史
/// </summary>
[SugarTable(nameof(WmsInventoryHistory), "库存变动历史")]
public class WmsInventoryHistory : EntityBase
{
    /// <summary>
    /// 产品编码
    /// </summary>
    [SugarColumn(ColumnDescription = "产品编码", IsNullable = false, Length = 20)]
    public long ProductId { get; set; }

    /// <summary>
    /// 变动时间
    /// </summary>
    [SugarColumn(ColumnDescription = "变动时间", IsNullable = false)]
    public DateTime ChangeDate { get; set; }

    /// <summary>
    /// 变动类型(IN-入库/OUT-出库)
    /// </summary>
    [SugarColumn(ColumnDescription = "变动类型(IN-入库/OUT-出库)", IsNullable = false, Length = 5)]
    public string ChangeType { get; set; }

    /// <summary>
    /// 变动数量
    /// </summary>
    [SugarColumn(ColumnDescription = "变动数量", IsNullable = false)]
    public int Quantity { get; set; }

    /// <summary>
    /// 操作人
    /// </summary>
    [SugarColumn(ColumnDescription = "操作人", IsNullable = false, Length = 50)]
    public string Operator { get; set; }

    /// <summary>
    /// 变动后库存
    /// </summary>
    [SugarColumn(ColumnDescription = "current_stock", IsNullable = false)]
    public int CurrentStock { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    [SugarColumn(ColumnDescription = "备注", Length = 500, IsNullable = true)]
    public string Remark { get; set; }

    /// <summary>
    /// 产品信息（导航属性）
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(ProductId))]
    public WmsProduct Product { get; set; }
}
